from tortoise import fields
from tortoise.models import Model


class Explore(Model):
    id = fields.IntField(pk=True)
    name = fields.CharField(max_length=255, description="探索问题名称")
    introduction = fields.TextField(description="探索问题简介")
    cover = fields.CharField(max_length=255, description="探索问题对应封面")
    audio = fields.CharField(max_length=255, description="探索问题对应音频")
    passage = fields.TextField(description="音频对应文稿")
    update_time = fields.DatetimeField(auto_now_add=True, description="问题更新时间")
    explore_order = fields.DatetimeField(auto_now_add=True, description="探索顺序")

    def __str__(self):
        return self.id

    class Meta:
        db_table = "explore"
        table_description = "探索表"


class Explore_Reason(Model):
    id = fields.IntField(pk=True)
    explore_id = fields.IntField(description="探索id")
    reason_id = fields.IntField(description="原因序号")
    reason_content = fields.CharField(max_length=255, description="原因内容")

    def __str__(self):
        return self.id

    class Meta:
        db_table = "explore_reason"
        table_description = "探索原因表"


class Explore_Solve(Model):
    id = fields.IntField(pk=True)
    explore_id = fields.IntField(description="探索id")
    solve_id = fields.IntField(description="解决思路id")
    solve_content = fields.CharField(max_length=255, description="解决思路内容")

    def __str__(self):
        return self.id

    class Meta:
        db_table = "explore_solve"
        table_description = "探索解决思路表"


class Explore_Evaluation(Model):
    id = fields.IntField(pk=True)
    explore_id = fields.IntField(description="探索id")
    gauge_id = fields.IntField(description="量表编号")
    recommendation = fields.CharField(max_length=255, description="推荐语")

    def __str__(self):
        return self.id

    class Meta:
        db_table = "explore_evaluation"
        table_description = "探索关联测评表"


class User_Explore(Model):
    id = fields.IntField(pk=True)
    user_id = fields.IntField(description="用户id")
    baby_id = fields.IntField(description="宝贝id")
    explore_id = fields.IntField(description="探索id")
    age_range = fields.CharField(max_length=255, description="年龄段")
    explore_time = fields.DatetimeField(auto_now_add=True, description="探索时间")

    def __str__(self):
        return self.id

    class Meta:
        db_table = "user_explore"
        table_description = "用户探索表"


